package com.kuang.design.creation.prototype;

import lombok.Data;

@Data
public class User implements Cloneable{
    private String userName;
    private Integer age;

    public User(){
        System.out.println("User对象创建");
    }


    /**
     * 创建
     * @return
     * @throws CloneNotSupportedException
     */
    @Override
    protected Object clone() throws CloneNotSupportedException {
        User user = new User();
        user.setAge(this.age);
        user.setUserName(this.userName);
        return user;
    }
}
